Open Dev Kit Documentation :: Demo - Basketball
Very simple 2D physics-based basketball game utilizingHow it Works
- Game Initialization
- Player Controls
- Interaction with the game is done by pressing the spacebar. A script located in the
Pressed andReleased Events of theControls Keybinds Resource is then executed. Pressing and holding it creates a new ball actor using theCreateBall function, then aTimer (ShootTimer ) starts ticking, handling the charging shooting power mechanic each tick. Releasing the spacebar stops theTimer and causes the ball to fling forward by setting the currently spawned ball'sPhysics Type to "Dynamic" and changing its velocity based on the stored power value of the charging mechanic. - UI & Score Tracking
- The UI
Scene displays the number of goals scored and total shots taken. Every time the spacebar key is released, the shots variable (specificallyBallsThrown ) increments by one. Goal points are counted by theShotChecker actor which is placed in the middle of the net. When ball actors make contact with it, itsCollision Actor Started Event increments theGoals variable by one.
If you think anything is missing, please feel free to: submit documentation feedback on this page